<?php
function loadAdmin($action){
	require 'admin/'.$action.'.php';
	$action = ucfirst($action);
	$act = new $action();;
	return $act;
}
function template($page,$data=null){
	if(sizeof($data)>=1){
		extract($data);
	}
	
	if(is_array($page)){
		foreach($page as $p){
			require 'admin/template/'.$p.'.php';
		}
	}else{
		require 'admin/template/'.$page.'.php';
	}
}
function incTemplate($page){
	return 'admin/template/'.$page.'.php';
}
function message($message,$url){
	require 'admin/template/message.php';
	exit();
}
function setMessage($result,$msg,$message){
	$message['success'] = $result;
	$message['message'] = $msg;
	return $message;
}
function saveDataFile($prefix,$lang,$filestr){
	$fp = fopen('data/'.$prefix .'.'. $lang . '.php','w'); 
	fputs($fp, $filestr);
	fclose($fp);
}